<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
     function showTime()
     {
         document.getElementById("time").innerText = new Date();
     }

     var timer=setInterval(function() {
        showTime()
     }, 1000);

    </script>

</head>
<body onload="showTime()">

<div id="time"></div>

</body>
</html>